Skip to content

feat(core): Add enableTruncation option to Vercel AI integration#20195

Open
nicohrubec wants to merge 3 commits intodevelopfrom
nh/vercel-enable-truncation
Open

feat(core): Add enableTruncation option to Vercel AI integration#20195
nicohrubec wants to merge 3 commits intodevelopfrom
nh/vercel-enable-truncation

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented Apr 10, 2026

This PR adds an enableTruncation option to the Vercel GenAI integration that allows users to disable input message truncation. It defaults to true to preserve existing behavior.

Closes #20140

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Core

  • Add enableTruncation option to Vercel AI integration by nicohrubec in #20195
  • Add enableTruncation option to OpenAI integration by andreiborza in #20167
  • Export a reusable function to add tracing headers by JPeer264 in #20076

Deps

  • Bump hono from 4.12.7 to 4.12.12 by dependabot in #20118
  • Bump defu from 6.1.4 to 6.1.6 by dependabot in #20104

Bug Fixes 🐛

  • (deno) Avoid inferring invalid span op from Deno tracer by Lms24 in #20128
  • (e2e) Add op check to waitForTransaction in React Router e2e tests by copilot-swe-agent in #20193

Internal Changes 🔧

  • (bugbot) Add rules to flag test-flake-provoking patterns by Lms24 in #20192
  • (deps) Bump axios from 1.13.5 to 1.15.0 in /dev-packages/e2e-tests/test-applications/nestjs-basic by dependabot in #20179
  • (size-limit) Bump failing size limit scenario by Lms24 in #20186

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.72 kB - -
@sentry/browser - with treeshaking flags 24.21 kB - -
@sentry/browser (incl. Tracing) 42.73 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.35 kB - -
@sentry/browser (incl. Tracing, Replay) 81.54 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.11 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 86.25 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 98.45 kB - -
@sentry/browser (incl. Feedback) 42.51 kB - -
@sentry/browser (incl. sendFeedback) 30.39 kB - -
@sentry/browser (incl. FeedbackAsync) 35.38 kB - -
@sentry/browser (incl. Metrics) 27.04 kB - -
@sentry/browser (incl. Logs) 27.18 kB - -
@sentry/browser (incl. Metrics & Logs) 27.86 kB - -
@sentry/react 27.48 kB - -
@sentry/react (incl. Tracing) 45.05 kB - -
@sentry/vue 30.56 kB - -
@sentry/vue (incl. Tracing) 44.59 kB - -
@sentry/svelte 25.74 kB - -
CDN Bundle 28.41 kB - -
CDN Bundle (incl. Tracing) 43.75 kB - -
CDN Bundle (incl. Logs, Metrics) 29.78 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.83 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.59 kB - -
CDN Bundle (incl. Tracing, Replay) 80.64 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.66 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 86.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 87.2 kB - -
CDN Bundle - uncompressed 82.99 kB - -
CDN Bundle (incl. Tracing) - uncompressed 129.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 87.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 133.19 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 210.12 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 246.65 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 250.05 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 259.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 262.95 kB - -
@sentry/nextjs (client) 47.47 kB - -
@sentry/sveltekit (client) 43.2 kB - -
@sentry/node-core 57.86 kB +0.02% +7 B 🔺
@sentry/node 174.88 kB +0.04% +59 B 🔺
@sentry/node - without tracing 97.97 kB +0.03% +22 B 🔺
@sentry/aws-serverless 115.22 kB +0.02% +19 B 🔺

View base workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 11,412 - 8,946 +28%
GET With Sentry 2,086 18% 1,711 +22%
GET With Sentry (error only) 7,635 67% 6,044 +26%
POST Baseline 1,321 - 1,195 +11%
POST With Sentry 651 49% 602 +8%
POST With Sentry (error only) 1,158 88% 1,043 +11%
MYSQL Baseline 3,568 - 3,225 +11%
MYSQL With Sentry 512 14% 434 +18%
MYSQL With Sentry (error only) 3,039 85% 2,617 +16%

View base workflow run

@nicohrubec nicohrubec requested a review from andreiborza April 10, 2026 11:31
@nicohrubec nicohrubec marked this pull request as ready for review April 10, 2026 11:31
Comment on lines +122 to +124
const enableTruncation = integration?.options?.enableTruncation ?? true;

processGenerateSpan(span, name, attributes, enableTruncation);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The enableTruncation option for vercelAIIntegration is only implemented for Node.js. On other platforms (Cloudflare, Deno, Vercel Edge), truncation is always enabled and cannot be configured.
Severity: MEDIUM

Suggested Fix

To ensure consistent behavior, extend the vercelAIIntegration in the Cloudflare, Deno, and Vercel Edge packages to accept and store an options object, similar to the Node.js implementation. Alternatively, document that the enableTruncation option is only available for the Node.js SDK.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/core/src/tracing/vercel-ai/index.ts#L122-L124

Potential issue: The core tracing logic attempts to read
`integration?.options?.enableTruncation` to control message truncation for the Vercel AI
integration. However, the integration factory function was only updated to accept and
store these options for the Node.js SDK. For other platforms like Cloudflare, Deno, and
Vercel Edge, the integration object has no `options` property. The code defensively
falls back to `true`, meaning truncation is permanently enabled on these non-Node
platforms with no way for users to disable it, creating a feature disparity.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicohrubec this is legit, e.g.:

Doesn't take any options.

@nicohrubec nicohrubec requested a review from mydea April 10, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add enableTruncation option to Vercel AI integration

2 participants